﻿

//消息反馈列表
var formatShow = function (elCell, oRecord, oColumn, sData) {
    var cx = oRecord.getData("replyCX");
    var msgid = oRecord.getData("ID")
    if(cx>0) {

//        elCell.innerHTML = "<a href='javascript:transForForm(\"查看回复内容\",\"../Extend/MsgreplyList.aspx?r=" + Math.random() + "&id=" + msgid + "\");'>查看回复内容</a><br />";

        elCell.innerHTML = "<a href='javascript:transForForm(\"查看回复内容\",\"../EHR/MsgReplyPage.aspx?r=" + Math.random() + "&id=" + msgid + "&UserID=&ps=1\");'>查看回复内容</a><br />";

    }
    
    //    var WorkFlowInstanceId = oRecord.getData("WorkFlowInstanceId");
    //    var workflowId = oRecord.getData("WorkFlowId");
    //    var taskCaption = oRecord.getData("TaskCaption");
    //    var url = '"' + "../../Crm/BasePages/WorkflowMap.aspx?WorkFlowInstanceId=" + WorkFlowInstanceId + "&workflowId=" + workflowId + '"';
    //    var title = '"' + taskCaption + '流程图"';
    //    elCell.innerHTML = "<a href='javascript:transForForm(" + title + "," + url + ")'>流程图</a><br />";
}

var transForForm = function (title, url) {
    parent.addTabs(title, url);
    parent.NeedRefreshPage = this;
}


//获取url里的参数值 name:参数名称
function getPar(source, name) {
    var reg = new RegExp("(^|\\?|&)" + name + "=([^&]*)(\\s|&|$)", "i");
    if (reg.test(source))
        return RegExp.$2;
    return "";
};

//双击事件
function CustomDbClick() {
    fnCustomEdit();
}
//----------------------------------------------

//增加
var fnCustomAdd = function () {
    var list = mDataTable.getRecordSet()._records;
    var elist = [];
    for (var i = 0; i < list.length; i++) {
        if (list[i]._oData["iSun_Selected"] == true) {
            elist.push(list[i]._oData[const_entityID]);
            break;
        }
    }

    var pagetitle = "提交建议";
    parent._employeeTitle = pagetitle;
    parent.addTabs(pagetitle, encodeURI("../Extend/MsgreplyModify.aspx?r=" + Math.random() + "&entity=V_MsgFKList&id="));
    parent.NeedRefreshPage = this;
}
//编辑
var fnCustomEdit = function () {

    var recordID = myDataTable.getSelectedRows()[0];
    record = myDataTable.getRecord(recordID);
    //var a = record.getData(const_entityID)
    if (record == null) {
        alert("请选择一条记录");
        return;
    }

    var isReplyCX = record.getData("replyCX");
    var ID = record.getData("ID");
    if (typeof (isReplyCX) != "undefined" && isReplyCX > 0) {
        alert("不允许操作已回复内容的数据!");
        return;
    }

//    var const_EditEntity = "tmInformation";
//    var pagetitle = "培训资料修改";
//    parent._employeeTitle = pagetitle;
//    parent.addTabs(pagetitle, encodeURI("../Extend/Edit.aspx?r=" + Math.random() + "&entity=" + const_EditEntity + "&id=" + record.getData(const_entityID) + ""));
//    parent.NeedRefreshPage = this;

    var pagetitle = "修改反馈信息";
    parent._employeeTitle = pagetitle;
    parent.addTabs(pagetitle, encodeURI("../Extend/MsgreplyModify.aspx?r=" + Math.random() + "&entity=V_MsgFKList&id=" + record.getData(const_entityID) + ""));
    parent.NeedRefreshPage = this;

}
//删除
var fnCustomDelete = function () {
    var recordID = myDataTable.getSelectedRows()[0];
    record = myDataTable.getRecord(recordID);
    if (record == null) {
        alert("请选择一条记录");
        return;
    }

    var isReplyCX = record.getData("replyCX");
    var ID = record.getData("ID");
    if (typeof (isReplyCX) != "undefined" && isReplyCX > 0) {
        alert("不允许操作已回复内容的数据!");
        return;
    }

    var const_EditEntity = "DatSysNewsMonth";

    var list = mDataTable.getRecordSet()._records;
    var elist = [];
    dl = [];
    for (var i = 0; i < list.length; i++) {
        if (list[i]._oData["iSun_Selected"] == true) {
            elist.push(list[i]._oData[const_entityID]);
            dl.push(list[i]._sId); //获取行ID；
        }
    }
    SaveUrl = "../Extend/AjaxData/DataSave.aspx?r=" + Math.random() + "&action=delete&entity=" + const_EditEntity + "&id=" + ID;
    YAHOO.example.container.dialog3.show();


    //    var recordID = myDataTable.getSelectedRows()[0];
    //    record = myDataTable.getRecord(recordID);
    //    if (record == null) {
    //        alert("请选择一条记录");
    //        return;
    //    }

    //    var isReplyCX = record.getData("replyCX");
    //    var ID = record.getData("ID");
    //    if (typeof (isReplyCX) != "undefined" && isReplyCX > 0) {
    //        alert("不允许操作已回复内容的数据!");
    //        return;
    //    }

    //    var const_EditEntity = "DatSysNewsMonth";

    //    SaveUrl = "../Extend/AjaxData/DataSave.aspx?r=" + Math.random() + "&action=delete&entity=" + const_EditEntity + "&id=" + ID;

    //    YAHOO.example.container.dialog3.show();
    //    mDataTable.deleteRow(recordID);

}

//初始化内置页面时

$(document).ready(function () { 
    
});